1. Field of the Invention
The present invention relates to a recording apparatus configured to receive data or a command from outside and record the received data or command, and a method of controlling the recording apparatus.
2. Description of the Related Art
In recent years, devices such as printers have decreased in price and increased in performance. To satisfy these requirements, logic circuits such as a CPU or a memory (RAM, ROM, etc) are often integrated in one chip as an integrated circuit (ASIC etc.)
In the integrated circuit, the RAM occupies a relatively large area. Accordingly, in the devices for which the cost reduction is required, it is necessary to reduce capacity of the RAM as much as possible.
To solve the problem, for example, a technique for reducing capacity of a memory (for example, print buffer) for storing recording data as much as possible by receiving only an amount of data necessary for one scan recording from a host device has been discussed.
With reference to FIG. 4, operation of a recording apparatus will be described. FIG. 4 illustrates data in a print buffer 42 and a recording operation of the data on a recording medium 105. At the same time as recording data of five blocks is stored in the print buffer (B1), a record scanning by a recording head is started (A1).
Then, the recording head scans data of 512 dots corresponding to a first block 1 and completes the recording of the data corresponding to the block 1 (A2). Then, in the print buffer 42, in the memory area where the block 1 data was stored, recording data of block 6 is stored (B2).
As shown by the numeral 111, when the recording head scans data of the next 512 dots and the recording of the block 2 data is completed (A3), recording data of a block 7 is stored (B3) in the memory area of the block 2. Consecutively, the recording is performed by reusing the memory area of recorded block. When recording of recording data of the last block 10 is completed, a main scanning by the recording head 104 is completed. Thus, the recording is efficiently performed by using a print buffer having less capacity than the recording data corresponding to the amount of one scanning.
FIGS. 6A and 6B illustrate an example to save memory capacity of the print buffer. FIG. 6A illustrates a state in which recording data corresponding to each color in a block is stored. In this case, in the order of black (Bk), cyan (C), magenta (M), and yellow (Y), data of the maximum of 128×512 dots can be recorded respectively. The maximum of volume of this block is 128×512×4 dots. FIG. 6B illustrates a case in which recording data for recording dots of magenta does not exist. In this case, recording data of black (Bk), cyan (C), and subsequently, yellow (Y) is recorded, and the memory capacity is reduced to 128×512×3 dots.
In the case of FIG. 6A, block color information which shows whether the recording data exists on each color, is Bk, C, M, Y=(1111) (4 bits) since all color data exist. On the other hand, in the case of FIG. 6B, since the recording data of magenta does not exist, the block color information is Bk, C, M, Y=(1101) (4 bits). Since it is possible to reduce the recording data and store the reduced recording data, the used region in each block in the print buffer can be saved.
FIG. 2 illustrates a state in which data received from the host device is stored in a receive buffer 41. The upper part of FIG. 2 is a head address of the receive buffer. From the head address (address 0), the data is stored in the buffer in sequence. In the receive buffer, as shown in FIG. 2, commands (image data commands) and data (image data) are stored in order of reception. These commands and data are read out in order of reception.
A mode set command indicates information about printing (recording) operation to the recording apparatus (printer). For example, the mode set command includes information about a size of paper, operation mode (for example, image quality priority mode, speed priority mode etc.), type of color (for example, black-and-white mode, color mode, etc), shape of block per one color for print buffer, the number of color, or the like.
The image data commands and image data corresponding to each block are transmitted from a host device. The image data command includes information about the number of data per block, etc. The image data corresponds to print data (recording data) of each block.
FIG. 3 illustrates a process of print data in a conventional printer. A CPU 10 sets a start address and an end address of a receive buffer region to a receive buffer control circuit 7 in advance. In an example of FIG. 2, the start address is “0” and the end address is “1”.
The CPU 10 allows an interface control circuit 5 to receive data. The data is sent from a host (host device) 50. The data sent from the host 50 is received in the interface control circuit 5 in an ASIC 20. The interface control circuit 5 sends the data to the receive buffer control circuit 7. The receive buffer control circuit 7 uses a write pointer 101 which is managed by a receive buffer address management circuit 1, through a memory controller 3, and stores the data in the receive buffer 41 which is provided in memory 4. The receive buffer address management circuit 1 updates a value of the write pointer 101 every time the memory controller 3 writes in the memory 4.
After it is confirmed that the data has been stored in the receive buffer 41, the CPU 10 uses a read pointer 102, which is managed by the receive buffer address management circuit 1, and reads out the data from the receive buffer. The receive buffer address management circuit 1 updates the value of the read pointer 102 every time the data is read out from the memory.
When the readout of the receive data is started, firstly, the mode set command is read out. The CPU 10 interprets the readout command and obtains information about a print mode, the number of colors, etc. In accordance with the information, blocks are allocated in a print buffer. For example, the number of blocks or size of the block is set to a print buffer control circuit 8.
Further, the CPU 10, by using the read pointer 102, reads out an image data command 1 stored in the receive buffer 41 and interprets the command. In the image data command 1, the number of data of a subsequently stored image data 1 is written. The CPU interprets the image data command 1 and knows the number of print data in a block to be received.
After the CPU 10 interprets the image data command, the settings for an unpack control circuit 6 are configured on the basis of the image data command. Then, the unpack control circuit 6 reads out the image data 1 stored in the receive buffer using the read pointer 102. The readout is performed by, for example, a DMA transfer, and the read pointer 102 indicates that addresses of DMA sender proceeds.
Since the image data 1 is packed, an unpack process is performed in the unpack control circuit 6, and the data is transferred to a print buffer control circuit 8. When the DMA transfer of the image data 1 is completed, the unpack control circuit 6 reads out an image command 2 stored in the receive buffer and interprets the readout command using the read pointer 102. Then, an image data 2 is read out. Subsequently, the interpretation of image data commands and readout of image data are performed in order.
The print buffer control circuit 8 controls storage and readout of the unpacked data to and from a print buffer 42. The print buffer control circuit 8 stores the data in the print buffer using a write pointer 201, and reads out the stored data from the print buffer using a read pointer 202.
After the storage in the print buffer 42 is performed and a predetermined amount of image data is stored, the CPU instructs to start an printing operation.
However, the time necessary for the above readout of the image data from the receive buffer takes more time than the time necessary for the storage of the data in the receive buffer. The first reason is that the data to be read out is packed data, and it is necessary to unpack the packed data. The second reason is that the interpretation of commands is performed by the CPU.
Further, in order to confirm that the predetermined number of blocks of data or commands are stored in the receive buffer, it is necessary to read out the commands or data in order of reception.
As shown in FIG. 2, the commands and image data are alternately stored in the receive buffer. Accordingly, it is not possible to read out the next block if the readout of the previously received block is not completed. That is, in order to confirm that a necessary number of blocks have been received, it is necessary to read out the data for all the blocks.
As described above, conventionally, before starting the recording of data corresponding to the amount of one scan by using the recording head, in order to confirm in advance that the recording device has received a predetermined amount of data (for example, data of five blocks), the five blocks of commands and data of the receive buffer 41 are read out. If the five blocks of commands and data of the receive buffer are read out, to prevent the process being wasted, the read out commands and data are stored in the print buffer. Accordingly, a region corresponding to the amount of the five blocks of data, is provided in the print buffer 42.
Thus, as shown in FIG. 7, the number of blocks to be stored in the receive buffer 41 and the number of blocks to be stored in the print buffer 42 are equal. In the example of FIG. 7, the number of blocks is five. Further, FIG. 7 illustrates that the capacity corresponding to one block to be stored in the print buffer 42 is larger than that in the receive buffer 41.
In recent years, further reduction in capacity of memory in recording devices has been required. To reduce the memory capacity, for example, reduction in capacity of print buffer or receive buffer can be considered. However, in the above-described structure, it is difficult to reduce the capacity of memory. Further, improvement of throughput of recording is also required to the recording devices.